--====================================
--  Adds a new blank row to the dependant table
--====================================
USE [labprod]
GO

IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[UserSettingsInsert]'))
DROP TRIGGER [dbo].[UserSettingsInsert]
GO

CREATE TRIGGER [UserSettingsInsert] ON [labprod].[dbo].[UserIdentity]
	AFTER INSERT
AS
	-- insert blank record into UserSettings table with ID just inserted into UserIdentity
	INSERT INTO [labprod].[dbo].[UserSettings]
	(
		[Email],
		[Settings]
	)
	VALUES
	(
		(SELECT [Email] FROM INSERTED),
		'<Settings></Settings>'
	)
GO 


